the_nums = [1, 7, 2, 7, 3, 7, 4, 7, 5, 7]


def majorityElement(nums):
    count = 0
    candidate = None

    for num in nums:
        if count == 0:
            candidate = num
        count += (1 if num == candidate else -1)

    return candidate


print(majorityElement(the_nums))
